**************************************************************************************************************************************************
***************** Trait Preferences for Leaders During War: Experimental and Panel-Based Evidence from Ukraine 2022 ******************************
**************************************************************************************************************************************************

log using trait_preferences_Ukraine


**************************************************************************************************************************************************
*************************************************************** RECODINGS ************************************************************************
**************************************************************************************************************************************************

***************************************************************** Wave 1 *************************************************************************

************************************************** Demographic background variables **************************************************************
* Sex
recode w1_q3 (1=0 "Male") (2=1 "Female") (3=.), gen(sex)

* Age
clonevar age = w1_q4

* Education
recode w1_q6 (1 2 =1 "Primary or High school") (3=2 "Professional-technical (vocational)") (4=3 "Incomplete higher") (5=4 "Bachelor degree") (6 7=5 "Master degree & Doctorate") (8=.), gen(education)
tab education

* Region
clonevar region = w1_region_aggregate


************************************************ Experimental treatment for Ideal Leader Experiment **********************************************
* Experimental treatment for leader trait evaluation questions
recode w1_leader_exp_condition (1=1 "Conflict, now") (2=2 "Peace, future"), generate(Context)

clonevar Conflict_1 = Context


*************************************** Leadership trait preferences in IDEAL LEADER *************************************************************
* Competent
recode w1_q14_1 (8=.)
generate Competence_1 = (w1_q14_1-1)/6

* Trustworthy
recode w1_q14_2 (8=.)
generate Trustworthy_1 = (w1_q14_2-1)/6

* Dominant
recode w1_q14_3 (8=.)
generate Dominant_1 = (w1_q14_3-1)/6

* Generous
recode w1_q14_4 (8=.)
generate Generous_1 = (w1_q14_4-1)/6

* Strong
recode w1_q14_5 (8=.)
generate Strong_1 = (w1_q14_5-1)/6

* Warm
recode w1_q14_6 (8=.)
generate Warm_1 = (w1_q14_6-1)/6

* Tough-minded
recode w1_q14_7 (8=.)
generate Toughminded_1 = (w1_q14_7-1)/6

summ Competence_1 Trustworthy_1 Dominant_1 Generous_1 Strong_1 Warm_1 Toughminded_1


*** Exploring dimensions in trait impressions of IDEAL LEADER based on Principal Component Analysis
factor Competence_1 Trustworthy_1 Dominant_1 Generous_1 Strong_1 Warm_1 Toughminded_1, pcf
rotate, oblique oblimin

* Creates factor score variables for robustness tests of main results
predict Comp_PCA_1 Warm_PCA_1 Domi_PCA_1
corr Comp_PCA_1 Warm_PCA_1 Domi_PCA_1

*** Main outcome variables: Composite scales for dominance, warmth and competence (on 0-1 scales)
egen Domi_scale_1 = rowmean(Dominant_1 Toughminded_1)

egen Comp_scale_1 = rowmean(Competence_1 Trustworthy_1 Strong_1)

egen Warm_scale_1 = rowmean(Warm_1 Generous_1)

summ Domi_scale_1 Comp_scale_1 Warm_scale_1
corr Domi_scale_1 Comp_scale_1 Warm_scale_1


****************************************** Leadership trait perceptions of CURRENT LEADER, Zelenskyy *********************************************
* Competent
recode w1_q15_1 (8=.)
generate Zel_Comp_1 = (w1_q15_1-1)/6

* Trustworthy
recode w1_q15_2 (8=.)
generate Zel_Trust_1 = (w1_q15_2-1)/6

* Dominant
recode w1_q15_3 (8=.)
generate Zel_Domi_1 = (w1_q15_3-1)/6

* Generous
recode w1_q15_4 (8=.)
generate Zel_Generous_1 = (w1_q15_4-1)/6

* Strong
recode w1_q15_5 (8=.)
generate Zel_Strong_1 = (w1_q15_5-1)/6

* Warm
recode w1_q15_6 (8=.)
generate Zel_Warm_1 = (w1_q15_6-1)/6

* Tough-minded
recode w1_q15_7 (8=.)
generate Zel_Tough_1 = (w1_q15_7-1)/6


summ Zel_Comp_1 Zel_Trust_1 Zel_Domi_1 Zel_Generous_1 Zel_Strong_1 Zel_Warm_1 Zel_Tough_1


** Creates composite scales for perceptions of Zelenskyy on the same three trait dimensions as for "ideal leader ratings": dominance, warmth and competence.
egen Comp_scale_Zel1 = rowmean(Zel_Comp_1 Zel_Trust_1 Zel_Strong_1)
alpha Zel_Comp_1 Zel_Trust_1 Zel_Strong_1

egen Warm_scale_Zel1 = rowmean(Zel_Warm_1 Zel_Generous_1)
alpha Zel_Warm_1 Zel_Generous_1

egen Domi_scale_Zel1= rowmean(Zel_Domi_1 Zel_Tough_1)
alpha Zel_Domi_1 Zel_Tough_1

summ Comp_scale_Zel1 Warm_scale_Zel1 Domi_scale_Zel1 





****************************************************** Self-reported emotional reactions over last week ******************************************
* Afraid
recode w1_q11_1 (8=.), generate(afraid_1)
* Frightened
recode w1_q11_2 (8=.), generate(frightened_1)
* Scared
recode w1_q11_3 (8=.), generate(scared_1)

** Composite scale for anxiety
corr afraid_1 frightened_1 scared_1
alpha afraid_1 frightened_1 scared_1
egen fearfull_scale_W1_7 = rowmean(afraid_1 frightened_1 scared_1)
generate fearfull_scale_1 = (fearfull_scale_W1_7-1)/6

* Angry
recode w1_q11_4 (8=.), generate(angry_1)
* Hostile
recode w1_q11_5 (8=.), generate(hostile_1)
* Disgusted
recode w1_q11_6 (8=.), generate(disgusted_1)

** Composite scale for agressive emotions
corr angry_1 hostile_1 disgusted_1
alpha angry_1 hostile_1 disgusted_1
egen aggressive_scale_W1_7 = rowmean(angry_1 hostile_1 disgusted_1)
generate aggressive_scale_1 = (aggressive_scale_W1_7-1)/6

* Sad
recode w1_q11_7 (8=.), generate(sad_1)
* Lonely
recode w1_q11_8 (8=.), generate(lonely_1)
* Downhearted
recode w1_q11_9 (8=.), generate(downhearted_1)

** Composite scale for sadness
corr sad_1 lonely_1 downhearted_1 
alpha sad_1 lonely_1 downhearted_1 
egen sadness_scale_W1_7 = rowmean(sad_1 lonely_1 downhearted_1)
generate sadness_scale_1 = (sadness_scale_W1_7-1)/6

* Proud
recode w1_q11_10 (8=.), generate(proud_1)
* Strong
recode w1_q11_11 (8=.), generate(strong_1)
* Confident
recode w1_q11_12 (8=.), generate(confident_1)

** Composite scale for self-confident emotions
corr proud_1 strong_1 confident_1
alpha proud_1 strong_1 confident_1
egen selfconf_scale_W1_7 = rowmean(proud_1 strong_1 confident_1)
generate selfconf_scale_1 = (selfconf_scale_W1_7-1)/6

summ fearfull_scale_1 aggressive_scale_1 sadness_scale_1 selfconf_scale_1





******************************************** Self-reported Victimization of Russian Attacks ******************************************************
**** Inspects all three items
codebook w1_q9_1 w1_q9_2 w1_q9_3
tab1 w1_q9_1 w1_q9_2 w1_q9_3
recode w1_q9_1 w1_q9_2 w1_q9_3 (6=.)
rename w1_q9_1 w1_victim_self
rename w1_q9_2 w1_victim_family
rename w1_q9_3 w1_victim_other
corr w1_victim_self w1_victim_family w1_victim_other
alpha w1_victim_self w1_victim_family w1_victim_other

** Generates victimization scale
egen Victimization_W1_5 = rowmean(w1_victim_self w1_victim_family w1_victim_other)
generate Victimization_1 = (Victimization_W1_5-1)/4
summ Victimization_1



******************************************** Identification with Ukraine, Russia and Europe ******************************************************
** Ukraine
recode w1_q23_1 (8=.), generate(Ukraine_ID_W1_7)
recode w1_q24_1 (8=.), generate(Ukraine_close_W1_7)
corr Ukraine_ID_W1_7 Ukraine_close_W1_7
egen ID_Ukraine_W1_7 = rowmean(Ukraine_ID_W1_7 Ukraine_close_W1_7)
generate ID_Ukraine_1 = (ID_Ukraine_W1_7-1)/6

** Russia
recode w1_q23_2 (8=.), generate(Russia_ID_W1_7)
recode w1_q24_2 (8=.), generate(Russia_close_W1_7)
corr Russia_ID_W1_7 Russia_close_W1_7
egen ID_Russia_W1_7 = rowmean(Russia_ID_W1_7 Russia_close_W1_7)
generate ID_Russia_1 = (ID_Russia_W1_7-1)/6

** Europe
recode w1_q23_3 (8=.), generate(Europe_ID_W1_7)
recode w1_q24_3 (8=.), generate(Europe_close_W1_7)
corr Europe_ID_W1_7 Europe_close_W1_7
egen ID_Europe_W1_7 = rowmean(Europe_ID_W1_7 Europe_close_W1_7)
generate ID_Europe_1 = (ID_Europe_W1_7-1)/6

summ ID_Ukraine_1 ID_Russia_1 ID_Europe_1




**************************************************************************************************************************************************
*************************************************************** WAVE 2 ***************************************************************************
**************************************************************************************************************************************************

****************************************** Leadership trait preferences in IDEAL LEADER **********************************************************
* Competent
recode w2_q12_1 (8=.)
generate Competence_2 = (w2_q12_1-1)/6

* Trustworthy
recode w2_q12_2 (8=.)
generate Trustworthy_2 = (w2_q12_2-1)/6

* Dominant
recode w2_q12_3 (8=.)
generate Dominant_2 = (w2_q12_3-1)/6

* Generous
recode w2_q12_4 (8=.)
generate Generous_2 = (w2_q12_4-1)/6

* Strong
recode w2_q12_5 (8=.)
generate Strong_2 = (w2_q12_5-1)/6

* Warm
recode w2_q12_6 (8=.)
generate Warm_2 = (w2_q12_6-1)/6

* Tough-minded
recode w2_q12_7 (8=.)
generate Toughminded_2 = (w2_q12_7-1)/6

summ Competence_2 Trustworthy_2 Dominant_2 Generous_2 Strong_2 Warm_2 Toughminded_2

*** Exploring dimensions in trait impressions of IDEAL LEADER based on Principal Component Analysis
factor Competence_2 Trustworthy_2 Dominant_2 Generous_2 Strong_2 Warm_2 Toughminded_2, pcf
rotate, oblique oblimin

* Creates factor score variables for robustness tests of main results
predict Comp_PCA_2 Warm_PCA_2 Domi_PCA_2
corr Comp_PCA_2 Warm_PCA_2 Domi_PCA_2

*** Main outcome variables: Composite scales for dominance, warmth and competence (on 0-1 scales)
egen Domi_scale_2 = rowmean(Dominant_2 Toughminded_2)

egen Comp_scale_2 = rowmean(Competence_2 Trustworthy_2 Strong_2)

egen Warm_scale_2 = rowmean(Warm_2 Generous_2)

summ Domi_scale_2 Comp_scale_2 Warm_scale_2
corr Domi_scale_2 Comp_scale_2 Warm_scale_2


******************************************* Self-reported emotional reactions over last week *****************************************************
* Afraid
recode w2_q11_1 (8=.), generate(afraid_2)
* Frightened
recode w2_q11_2 (8=.), generate(frightened_2)
* Scared
recode w2_q11_3 (8=.), generate(scared_2)

** Composite scale for anxiety
corr afraid_2 frightened_2 scared_2
alpha afraid_2 frightened_2 scared_2
egen fearfull_scale_W2_7 = rowmean(afraid_2 frightened_2 scared_2)
generate fearfull_scale_2 = (fearfull_scale_W2_7-1)/6


* Angry
recode w2_q11_4 (8=.), generate(angry_2)
* Hostile
recode w2_q11_5 (8=.), generate(hostile_2)
* Disgusted
recode w2_q11_6 (8=.), generate(disgusted_2)

** Composite scale for agressive emotions
corr angry_2 hostile_2 disgusted_2
alpha angry_2 hostile_2 disgusted_2
egen aggressive_scale_W2_7 = rowmean(angry_2 hostile_2 disgusted_2)
generate aggressive_scale_2 = (aggressive_scale_W2_7-1)/6


* Sad
recode w2_q11_7 (8=.), generate(sad_2)
* Lonely
recode w2_q11_8 (8=.), generate(lonely_2)
* Downhearted
recode w2_q11_9 (8=.), generate(downhearted_2)

** Composite scale for sadness
corr sad_2 lonely_2 downhearted_2 
alpha sad_2 lonely_2 downhearted_2 
egen sadness_scale_W2_7 = rowmean(sad_2 lonely_2 downhearted_2)
generate sadness_scale_2 = (sadness_scale_W2_7-1)/6


* Proud
recode w2_q11_10 (8=.), generate(proud_2)
* Strong
recode w2_q11_11 (8=.), generate(strong_2)
* Confident
recode w2_q11_12 (8=.), generate(confident_2)

** Composite scale for self-confident emotions
corr proud_2 strong_2 confident_2
alpha proud_2 strong_2 confident_2
egen selfconf_scale_W2_7 = rowmean(proud_2 strong_2 confident_2)
generate selfconf_scale_2 = (selfconf_scale_W2_7-1)/6

summ fearfull_scale_2 aggressive_scale_2 sadness_scale_2 selfconf_scale_2



******************************************* Self-reported Victimization of Russian Attacks *******************************************************
**** Recodes all three items
codebook w2_q8_1 w2_q8_2 w2_q8_3
tab1 w2_q8_1 w2_q8_2 w2_q8_3
recode w2_q8_1 w2_q8_2 w2_q8_3 (6=.)
rename w2_q8_1 w2_victim_self
rename w2_q8_2 w2_victim_family
rename w2_q8_3 w2_victim_other
corr w2_victim_self w2_victim_family w2_victim_other
alpha w2_victim_self w2_victim_family w2_victim_other


** Generates victimization scale
egen Victimization_W2_5 = rowmean(w2_victim_self w2_victim_family w2_victim_other)
generate Victimization_2 = (Victimization_W2_5-1)/4
summ Victimization_2


********************************************* Identification with Ukraine, Russia and Europe *****************************************************
** Ukraine
recode w2_q13_1 (8=.), generate(Ukraine_ID_W2_7)
recode w2_q14_1 (8=.), generate(Ukraine_close_W2_7)
corr Ukraine_ID_W2_7 Ukraine_close_W2_7
egen ID_Ukraine_W2_7 = rowmean(Ukraine_ID_W2_7 Ukraine_close_W2_7)
generate ID_Ukraine_2 = (ID_Ukraine_W2_7-1)/6

** Russia
recode w2_q13_2 (8=.), generate(Russia_ID_W2_7)
recode w2_q14_2 (8=.), generate(Russia_close_W2_7)
corr Russia_ID_W2_7 Russia_close_W2_7
egen ID_Russia_W2_7 = rowmean(Russia_ID_W2_7 Russia_close_W2_7)
generate ID_Russia_2 = (ID_Russia_W2_7-1)/6

** Europe
recode w2_q13_3 (8=.), generate(Europe_ID_W2_7)
recode w2_q14_3 (8=.), generate(Europe_close_W2_7)
corr Europe_ID_W2_7 Europe_close_W2_7
egen ID_Europe_W2_7 = rowmean(Europe_ID_W2_7 Europe_close_W2_7)
generate ID_Europe_2 = (ID_Europe_W2_7-1)/6

summ ID_Ukraine_2 ID_Russia_2 ID_Europe_2



********************************** Creates variable for whether data for all trait rating variables is present ***********************************
summ Domi_scale_2 Comp_scale_2 Warm_scale_2
generate include = .
replace include = 1 if Domi_scale_1 !=. & Warm_scale_1 !=. & Comp_scale_1 !=. & Domi_scale_2 !=. & Warm_scale_2 !=. & Comp_scale_2 !=.
tab include

** Creates similar variable based on PCA
generate include_PCA = .
replace include_PCA = 1 if Domi_PCA_1 !=. & Warm_PCA_1 !=. & Comp_PCA_1 !=. & Domi_PCA_2 !=. & Warm_PCA_2 !=. & Comp_PCA_2 !=.
tab include_PCA


****************************************** Experimental treatment for Ideal Leader Experiment in Wave 2 ******************************************
* Experimental treatment for leader trait evaluation questions; codes all respondents to be assigned to think of "Conflict, now"
generate Conflict_2=1



**************************************************************************************************************************************************
******************************************************* Difference scores ************************************************************************
**************************************************************************************************************************************************

*** Leader trait preferences in ideal leaders
* Composite scales
generate Domi_scale_diff = Domi_scale_2 - Domi_scale_1
generate Comp_scale_diff = Comp_scale_2 - Comp_scale_1
generate Warm_scale_diff = Warm_scale_2 - Warm_scale_1

summ Domi_scale_diff Comp_scale_diff Warm_scale_diff

* Single-item traits
generate Dominance_diff = Dominant_2 - Dominant_1
generate Toughminded_diff = Toughminded_2 - Toughminded_1

generate Competence_diff = Competence_2 - Competence_1
generate Trustworthy_diff = Trustworthy_2 - Trustworthy_1
generate Strong_diff = Strong_2 - Strong_1

generate Warm_diff = Warm_2 - Warm_1
generate Generous_diff = Generous_2 - Generous_1

summ Dominance_diff Toughminded_diff Competence_diff Trustworthy_diff Strong_diff Warm_diff Generous_diff


* Variables based on PCA results
generate Comp_PCA_diff = Comp_PCA_2 - Comp_PCA_1
generate Warm_PCA_diff = Warm_PCA_2 - Warm_PCA_1
generate Domi_PCA_diff = Domi_PCA_2 - Domi_PCA_1


*** Emotional reactions
generate fearfull_diff = fearfull_scale_2 - fearfull_scale_1
generate aggressive_diff = aggressive_scale_2 - aggressive_scale_1

generate sadness_diff = sadness_scale_2 - sadness_scale_1
generate selfconf_diff = selfconf_scale_2 - selfconf_scale_1

summ fearfull_diff aggressive_diff sadness_diff selfconf_diff

*** Identification with Ukraine, Russia and Europe
generate ID_Ukraine_diff = ID_Ukraine_2  - ID_Ukraine_1
generate ID_Europe_diff = ID_Europe_2 - ID_Europe_1
generate ID_Russia_diff = ID_Russia_2 - ID_Russia_1

summ ID_Ukraine_diff ID_Europe_diff ID_Russia_diff

*** Victimization of Russian attacks
generate Victimization_diff = Victimization_2- Victimization_1

summ Victimization_diff






**************************************************************************************************************************************************
************************************* SOM.1: Descriptive statistics for key variables across waves ***********************************************
**************************************************************************************************************************************************

**** Demographics across waves
* Wave 1
tab sex
summ age
tab education
tab region

* wave 2
tab sex if include == 1
summ age if include == 1
tab education if include == 1
tab region if include == 1


**** Trait rating scales
* Wave 1
summ Comp_scale_1 Warm_scale_1 Domi_scale_1 
alpha Competence_1 Trustworthy_1 Strong_1
alpha Warm_1 Generous_1
alpha Dominant_1 Toughminded_1


* Wave 2
summ Comp_scale_2 Warm_scale_2 Domi_scale_2 if include == 1
alpha Competence_2 Trustworthy_2 Strong_2 if include==1
alpha Warm_2 Generous_2 if include==1
alpha Dominant_2 Toughminded_2 if include==1

**** Emotional reactions
* Wave 1
summ fearfull_scale_1 aggressive_scale_1 sadness_scale_1 selfconf_scale_1
alpha afraid_1 frightened_1 scared_1 if include == 1
alpha sad_1 lonely_1 downhearted_1 if include == 1
alpha proud_1 strong_1 confident_1 if include == 1
alpha angry_1 hostile_1 disgusted_1 if include == 1

* wave 2
summ fearfull_scale_2 aggressive_scale_2 sadness_scale_2 selfconf_scale_2 if include==1
alpha afraid_2 frightened_2 scared_2 if include==1
alpha sad_2 lonely_2 downhearted_2 if include==1
alpha proud_2 strong_2 confident_2 if include==1
alpha angry_2 hostile_2 disgusted_2 if include==1


**** Identities
* Wave 1
sum ID_Ukraine_1 ID_Europe_1 ID_Russia_1
alpha Ukraine_ID_W1_7 Ukraine_close_W1_7
alpha Russia_ID_W1_7 Russia_close_W1_7
alpha Europe_ID_W1_7 Europe_close_W1_7

* Wave 2
sum ID_Ukraine_2 ID_Europe_2 ID_Russia_2 if include == 1
alpha Ukraine_ID_W2_7 Ukraine_close_W2_7 if include == 1
alpha Russia_ID_W2_7 Russia_close_W2_7 if include == 1
alpha Europe_ID_W2_7 Europe_close_W2_7 if include == 1

** Victimization
summ Victimization_1 
alpha w1_victim_self w1_victim_family w1_victim_other
summ Victimization_2 if include == 1
alpha w2_victim_self w2_victim_family w2_victim_other if include == 1


**************************************************************************************************************************************************
**************************************************************** MAIN ANALYSES *******************************************************************
**************************************************************************************************************************************************

********************************************** MAPPING WARTIME LEADER TRAIT PREFERENCES **********************************************************
*** Key results reported in main text and full models in SOM.2
reg Comp_scale_1 if Conflict_1 == 1 & include == 1
reg Comp_scale_2 if Conflict_1 == 1 & include == 1

reg Warm_scale_1 if Conflict_1 == 1 & include == 1
reg Warm_scale_2 if Conflict_1 == 1 & include == 1

reg Domi_scale_1 if Conflict_1 == 1 & include == 1
reg Domi_scale_2 if Conflict_1 == 1 & include == 1

*** Tests differences between traits in wave 1
ttest Comp_scale_1==Warm_scale_1 if Conflict_1 == 1 & include == 1
ttest Comp_scale_1==Domi_scale_1 if Conflict_1 == 1 & include == 1
ttest Warm_scale_1==Domi_scale_1 if Conflict_1 == 1 & include == 1

*** Tests differences between traits in wave 2
ttest Comp_scale_1==Warm_scale_2 if Conflict_2 == 1 & include == 1
ttest Comp_scale_1==Domi_scale_2 if Conflict_2 == 1 & include == 1
ttest Warm_scale_1==Domi_scale_2 if Conflict_2 == 1 & include == 1

*** Correlations between preferences for same traits across waves
pwcorr Comp_scale_1 Comp_scale_2 if Conflict_1 == 1, sig
pwcorr Competence_1 Trustworthy_1 Strong_1 Competence_2 Trustworthy_2 Strong_2 if Conflict_1 == 1, sig
reg Comp_scale_1 Comp_scale_2 if Conflict_1 == 1

pwcorr Warm_scale_1 Warm_scale_2 if Conflict_1 == 1, sig
pwcorr Generous_1 Warm_1  Generous_2 Warm_2 if Conflict_1 == 1, sig
reg Warm_scale_1 Warm_scale_2 if Conflict_1 == 1

pwcorr Domi_scale_1 Domi_scale_2 if Conflict_1 == 1, sig
pwcorr Dominant_1 Toughminded_1 Dominant_2 Toughminded_2 if Conflict_1 == 1, sig
reg Domi_scale_1 Domi_scale_2 if Conflict_1 == 1


***** Figure 1 is produced below after restructuring the data-file from wide to long



************************************************** TESTING THE CONFLICT-SENSITIVITY HYPOTHESIS ***************************************************
**** Tests if thinking about a peaceful future affect trait preferences in a leader in wave 1
*** Key results reported in main text and full models in SOM.3a
reg Comp_scale_1 i.Conflict_1
margins, dydx(Conflict_1) level(95) 
marginsplot,  recastci(rcap) yscale(range(-.1(.05).1)) ylabel(-.1(.05).1) recast(scatter) yline(0) ///
xtitle("Peace") ytitle("Marg. Effect of Peace on Competence Importance") title("Competence") scheme(s1mono) legend(off)  name(Competence, replace)

reg Warm_scale_1 i.Conflict_1
margins, dydx(Conflict_1) level(95) 
marginsplot,  recastci(rcap) yscale(range(-.1(.05).1)) ylabel(-.1(.05).1) recast(scatter) yline(0) ///
xtitle("Peace")  ytitle("Marg. Effect of Peace on Warmth Importance") title("Warmth") scheme(s1mono) legend(off)  name(Warmth, replace)

reg Domi_scale_1 i.Conflict_1
margins, dydx(Conflict_1) level(95) 
marginsplot,  recastci(rcap) yscale(range(-.1(.05).1)) ylabel(-.1(.05).1) recast(scatter) yline(0) ///
xtitle("Peace")  ytitle("Marg. Effect of Peace on Dominance Importance") title("Dominance") scheme(s1mono) legend(off)  name(Dominance, replace)

*** Creates Figure 2
graph combine Competence Warmth Dominance, scheme(s1mono) col(3) ysize(3) xsize(6)
graph export fig2.pdf, replace


***** Within-subjects test of conflict-sensitivity hypothesis is produced below after restructuring the data-file from wide to long




***************************** TESTING THE EFFECTS OF EMOTIONAL REACTIONS TO THE WAR ON LEADER TRAIT PREFERENCES **********************************
*** Key results reported in main text and full models in SOM.4
reg Comp_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Warm_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Domi_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1


*** Creates Figure 3
* Calculates observed ranges of changes (difference across waves) in fearfull and aggressive emotions in the sample
sum fearfull_diff if include==1
sum aggressive_diff if include==1

*Plot marginal effects for the ranges of changes in our sample
*Requires instalation of coefplot
*ssc install coefplot
*Comp
reg Comp_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
margins, at(c.fearfull_diff=(-.8333333(0.2).5555556)) post
est store comp_fearful

reg Comp_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
margins, at(c.aggressive_diff=(-.8333333(0.2).7777777)) post
est store comp_aggresive

coefplot (comp_fearful, recast(line) lcolor(green) lwidth(*3) ciopts(recast(rarea) color(green%50)) ylab(-0.15(0.05)0.15) /// 
            label("{&Delta} Fearfull emotions") yline(0, lpattern(dash)))  /// 
		 (comp_aggresive, recast(line) lcolor(blue) lwidth(*3) ciopts(recast(rarea) color(blue%50)) ylab(-0.15(0.05)0.15) /// 
		    label("{&Delta} Aggressive emotions")), ytitle("Predicted change in {bf:competence} preference" " ") scheme(s1mono) at
	graph save comp, replace
			
*Warm		
reg Warm_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
margins, at(c.fearfull_diff=(-.8333333(0.2).5555556)) post
est store warm_fearfull

reg Warm_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
margins, at(c.aggressive_diff=(-.8333333(0.2).7777777)) post
est store warm_aggressive

coefplot (warm_fearfull, recast(line) lcolor(green) lwidth(*3) ciopts(recast(rarea) color(green%50)) ylab(-0.15(0.05)0.15) /// 
            label("{&Delta} Fearfull emotions") yline(0, lpattern(dash)))  ///  
		 (warm_aggressive, recast(line) lcolor(blue) lwidth(*3) ciopts(recast(rarea) color(blue%50)) ylab(-0.15(0.05)0.15) /// 
		    label("{&Delta} Aggressive emotions")), ytitle("Predicted change in {bf:warmth} preference" " ") scheme(s1mono) at
	graph save warm, replace
	
*Domi
reg Domi_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
margins, at(c.fearfull_diff=(-.8333333(0.2).5555556)) post
est store domi_fearfull

reg Domi_scale_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
margins, at(c.aggressive_diff=(-.8333333(0.2).7777777)) post
est store domi_aggressive

coefplot (domi_fearfull, recast(line) lcolor(green) lwidth(*3) ciopts(recast(rarea) color(green%50)) ylab(-0.15(0.05)0.15) /// 
            label("{&Delta} Fearfull emotions") yline(0, lpattern(dash)))  /// 
		 (domi_aggressive, recast(line) lcolor(blue) lwidth(*3) ciopts(recast(rarea) color(blue%50)) ylab(-0.15(0.05)0.15) /// 
		    label("{&Delta} Aggressive emotions")), ytitle("Predicted change in {bf:dominance} preference" " ")scheme(s1mono) at
	graph save domi, replace
				
graph combine comp.gph warm.gph domi.gph, ycommon xsize(12) ysize(3) col(3) scale(1.45) scheme(s1mono)
graph export fig3.pdf, replace


**************************************************************************************************************************************************
********************************************************** SUPPLEMENTARY ANALYSES ****************************************************************
**************************************************************************************************************************************************

********************************************** SOM.6. ANALYSES USING SINGLE-ITEM TRAIT VARIABLES *************************************************
*** SOM 6.a: Average trait importance across survey waves based on single-item trait measures 
* Wave 1
reg Competence_1 if Conflict_1 == 1 & include == 1
reg Trustworthy_1 if Conflict_1 == 1 & include == 1
reg Strong_1 if Conflict_1 == 1 & include == 1

reg Warm_1 if Conflict_1 == 1 & include == 1
reg Generous_1 if Conflict_1 == 1 & include == 1

reg Dominant_1 if Conflict_1 == 1 & include == 1
reg Toughminded_1 if Conflict_1 == 1 & include == 1

* Wave 2
reg Competence_2 if Conflict_1 == 1 & include == 1
reg Trustworthy_2 if Conflict_1 == 1 & include == 1
reg Strong_2 if Conflict_1 == 1 & include == 1

reg Warm_2 if Conflict_1 == 1 & include == 1
reg Generous_1 if Conflict_1 == 1 & include == 1

reg Dominant_2 if Conflict_1 == 1 & include == 1
reg Toughminded_2 if Conflict_1 == 1 & include == 1



*** SOM 6.b: Testing the conflict-sensitivity hypothesis (with single-item trait variables)
reg Competence_1 i.Conflict_1
eststo SOM3b_model1

reg Trustworthy_1 i.Conflict_1
eststo SOM3b_model2

reg Strong_1 i.Conflict_1
eststo SOM3b_model3

reg Warm_1 i.Conflict_1
eststo SOM3b_model4

reg Generous_1 i.Conflict_1
eststo SOM3b_model5

reg Dominant_1 i.Conflict_1
eststo SOM3b_model6

reg Toughminded_1 i.Conflict_1
eststo SOM3b_model7

etable, estimates(SOM3b_model1 SOM3b_model2 SOM3b_model3 SOM3b_model4 SOM3b_model5 SOM3b_model6 SOM3b_model7) mstat(N) mstat(r2_a) showstars showstarsnote export(SOM3b.docx)



*** SOM 6.c: Testing the role of emotional reactions (with single-item trait variables)
reg Competence_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Trustworthy_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Strong_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Warm_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Generous_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Dominance_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

reg Toughminded_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1



********************************************** SOM.7. ANALYSES USING PCA FACTOR SCORES AS TRAIT VARIABLES *************************************************

*** SOM 7.a: Testing the Conflict-Sensitivity Hypothesis and effect of emotional reactions using factor score variables for trait dimensions
** Between-respondent analyses
reg Comp_PCA_1 i.Conflict_1
margins, dydx(Conflict_1) level(95) 
marginsplot,  recastci(rcap) yscale(range(-.3(.1).3)) ylabel(-.3(.1).3) recast(scatter) yline(0) ///
xtitle("Peace") ytitle("Marg. Effect of Peace on Competence (PCA factor score)") title("Competence (PCA factor score)") scheme(s1mono) legend(off)  name(Competence_PCA, replace)

reg Warm_PCA_1 i.Conflict_1
margins, dydx(Conflict_1) level(95) 
marginsplot,  recastci(rcap) yscale(range(-.3(.1).3)) ylabel(-.3(.1).3) recast(scatter) yline(0) ///
xtitle("Peace")  ytitle("Marg. Effect of Peace on Warmth (PCA factor score)") title("Warmth (PCA factor score)") scheme(s1mono) legend(off)  name(Warmth_PCA, replace)

reg Domi_PCA_1 i.Conflict_1
margins, dydx(Conflict_1) level(95) 
marginsplot,  recastci(rcap) yscale(range(-.3(.1).3)) ylabel(-.3(.1).3) recast(scatter) yline(0) ///
xtitle("Peace")  ytitle("Marg. Effect of Peace on Dominance (PCA factor score)") title("Dominance (PCA factor score)") scheme(s1mono) legend(off)  name(Dominance_PCA, replace)

* Creates common figure (not displayed in SOM.7)
graph combine Competence_PCA Warmth_PCA Dominance_PCA, scheme(s1mono) col(3) ysize(3) xsize(6)
graph export fig2_PCA.pdf, replace

** Within-respondent analyses: see below after dataset is re-shaped to long format


*** SOM. 7.b: Testing the role of emotional reactions to the war using factor score trait variables
reg Comp_PCA_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include_PCA==1

reg Warm_PCA_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include_PCA==1

reg Domi_PCA_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include_PCA==1


****************************** SOM.8. ANALYSES OF RELATIVE IMPORTANCE USING ALL AVAILABLE RESPONDENTS IN WAVE 1 *************************************************************
*** SOM 8: Testing the relative importance of leader competence, warmth and dominance in Wave 1 using all available respondents
reg Comp_scale_1 if Conflict_1 == 1 
reg Warm_scale_1 if Conflict_1 == 1 
reg Domi_scale_1 if Conflict_1 == 1 

reg Comp_scale_1 if Context== 1
margins, level(95)
marginsplot,  recastci(rcap) yscale(range(0(.1)1)) ylabel(0(.1)1) recast(scatter) yline(0) ///
xtitle("Competence") ytitle("Competence Importance") title("Competence") legend(off) scheme(s1mono) name(Comp_war_mean_SOM4, replace)

reg Warm_scale_1 if Context== 1
margins, level(95)
marginsplot,  recastci(rcap) yscale(range(0(.1)1)) ylabel(0(.1)1) recast(scatter) yline(0) ///
xtitle("Warmth") ytitle("Warmth Importance") title("Warmth") legend(off) scheme(s1mono) name(Warm_war_mean_SOM4, replace)

reg Domi_scale_1 if Context== 1
margins, level(95)
marginsplot,  recastci(rcap) yscale(range(0(.1)1)) ylabel(0(.1)1) recast(scatter) yline(0) ///
xtitle("Dominance") ytitle("Dominance Importance") title("Dominance") legend(off) scheme(s1mono) name(Domi_war_mean_SOM4, replace)

graph combine Comp_war_mean_SOM4 Warm_war_mean_SOM4 Domi_war_mean_SOM4, scheme(s1mono) cols(3)



*************************************************** SOM.9. ASSESSMENT OF POTENTIAL ATTRITION ********************************************************************
*** SOM 9: Assessing potential attrition bias
tab _merge
*[Overall, we reinterviewed 75.02% of Wave 1 sample]


*Generate dropout variable
tab _merge, nolab
gen dropout = .
replace dropout = 1 if _merge == 1
replace dropout = 0 if _merge == 3
tab dropout 

*** ATTRITION TESTS
*Lagged Comp_scale_1 (measured at Wave 1) alone
logit dropout Comp_scale_1
*Lagged Comp_scale_1 together with controls (all measured at Wave 1)
logit dropout Comp_scale_1 c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 c.w1_victim_self i.sex c.age i.edu

*Lagged Warm_scale_1 (measured at Wave 1) alone
logit dropout Warm_scale_1
*Lagged Warm_scale_1 together with controls (all measured at Wave 1)
logit dropout Warm_scale_1  c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 c.w1_victim_self i.sex c.age i.edu

*Lagged Warm_scale_1 (measured at Wave 1) alone
logit dropout Domi_scale_1
*Lagged Domi_scale_1 together with controls (all measured at Wave 1)
logit dropout Domi_scale_1  c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 c.w1_victim_self i.sex c.age i.edu


*************************************************** SOM.10. ALTERNATIVE 'RALLY AROUND THE FLAG' EXPLANATION ********************************************************************
*** SOM 10: Explores traits ratings of President Zelenskyy
* Do average ratings of Zelensky closely mirror stated trait preferences in ideal leader?
summ Comp_scale_Zel1 Warm_scale_Zel1 Domi_scale_Zel1

reg Comp_scale_Zel1 if Conflict_1 == 1 
reg Warm_scale_Zel1 if Conflict_1 == 1 
reg Domi_scale_Zel1 if Conflict_1 == 1 
// Ranking of traits is similar as for ideal leader. But rating of Z's competence is 0.15 scale points lower than for ideal leader.

* Does context (war vs. peace) affect ratings of Zalenskyy
reg Comp_scale_Zel1 i.Conflict_1
reg Warm_scale_Zel1 i.Conflict_1
reg Domi_scale_Zel1 i.Conflict_1
// Assigned context does not affect ratings of Zelensky

* Do Ratings of Zelensky correlate with stated trait preferences in ideal leader? NOT USED IN SOM.6
pwcorr Comp_scale_1 Comp_scale_Zel1, sig // r=0.113
pwcorr Warm_scale_1 Warm_scale_Zel1, sig // r=0.398
pwcorr Domi_scale_1 Domi_scale_Zel1, sig // r=0.443
// Ratings of Z and ideal leader correlate, but not overwhelmingly so


*************************************************** SOM.11. INDIVIDUAL VICTIMIZATION OF RUSSIAN ATTACKS ********************************************************************

*** SOM.11: Exploring if self-reported victimization by Russian attacks affect leader trait preferences
* Models controlling for changes in identification variables (models 1-3 in SOM.11)
reg Comp_scale_diff c.Victimization_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
reg Warm_scale_diff c.Victimization_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
reg Domi_scale_diff c.Victimization_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1

* Models also controlling for changes in emotional reactions (models 4-6 in SOM.11)
reg Comp_scale_diff c.Victimization_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
reg Warm_scale_diff c.Victimization_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1
reg Domi_scale_diff c.Victimization_diff c.fearfull_diff c.aggressive_diff c.sadness_diff c.selfconf_diff c.ID_Ukraine_diff c.ID_Europe_diff c.ID_Russia_diff if include==1



*************************************************** SOM.12. OBLAST-LEVEL ANALYSES OF RUSSIAN ATTACKS ********************************************************************

*** SOM.12: Exploring if oblast-level differences in attack intensity relates to trait preferences in leaders
** Adding VIINA events to the dataset
* Wave 1: N of events per oblast
tab w1_q5
tab w1_q5, nolab

** N of VIINA events (all types) in the 2-week period before Wave 1
* 2 Vinnytsya 279
* 3 Volyn	120
* 4 Dnipropetrovsk 279
* 5 Donetsk 2101
* 6 Zhytomyr 454
* 7 Transcarpathian 76
* 8 Zaporizhzhia 1280
* 9 Ivano-Frankivsk 51
* 10 Kyiv 1995
* 11 Kyiv city 3704
* 12 Kirovohrad 40
* 13 Luhansk 720
* 14 Lviv 393
* 15 Mykolayiv 805
* 16 Odessa 695
* 17 Poltava 126
* 18 Rivne 90
* 19 Sumy 1091
* 20 Ternopil 57
* 21 Kharkiv 2436
* 22 Kherson 938
* 23 Khmelnytsky 121
* 24 Cherkasy 139
* 25 Chernivtsi 29
* 26 Chernihiv 817
* Crimea 387 [no respondents reached in Crimea]
* Sevastopol 21 [no respondents reached in Sevastapol]

* Enters VIINA events/observations for Wave 1 to dataset
gen w1_VIINA_events = .
replace w1_VIINA_events = 279 if w1_q5 == 2
replace w1_VIINA_events = 120 if w1_q5 == 3
replace w1_VIINA_events = 279 if w1_q5 == 4
replace w1_VIINA_events = 2101 if w1_q5 == 5
replace w1_VIINA_events = 454 if w1_q5 == 6
replace w1_VIINA_events = 76 if w1_q5 == 7
replace w1_VIINA_events = 1280 if w1_q5 == 8
replace w1_VIINA_events = 51 if w1_q5 == 9
replace w1_VIINA_events = 1995 if w1_q5 == 10
replace w1_VIINA_events = 3704 if w1_q5 == 11
replace w1_VIINA_events = 40 if w1_q5 == 12
replace w1_VIINA_events = 720 if w1_q5 == 13
replace w1_VIINA_events = 393 if w1_q5 == 14
replace w1_VIINA_events = 805 if w1_q5 == 15
replace w1_VIINA_events = 695 if w1_q5 == 16
replace w1_VIINA_events = 126 if w1_q5 == 17
replace w1_VIINA_events = 90 if w1_q5 == 18
replace w1_VIINA_events = 1091 if w1_q5 == 19
replace w1_VIINA_events = 57 if w1_q5 == 20
replace w1_VIINA_events = 2436 if w1_q5 == 21
replace w1_VIINA_events = 938 if w1_q5 == 22
replace w1_VIINA_events = 121 if w1_q5 == 23
replace w1_VIINA_events = 139 if w1_q5 == 24
replace w1_VIINA_events = 29 if w1_q5 == 25
replace w1_VIINA_events = 817 if w1_q5 == 26

** Normalizes VIINA variable for Wave 1
summ w1_VIINA_events
gen VIINA_W1_norm = (w1_VIINA_events - r(min)) / (r(max) - r(min)) 
summ VIINA_W1_norm

** Creates log-transformed version of the normalized VIINA variable for Wave 1
gen ln_VIINA_W1_norm = ln(VIINA_W1_norm)



** N of VIINA events (all types) in the 2-week period before Wave 2
* 2 Vinnytsya 72
* 3 Volyn	150
* 4 Dnipropetrovsk 349
* 5 Donetsk 2274
* 6 Zhytomyr 180
* 7 Transcarpathian 117
* 8 Zaporizhzhia 763
* 9 Ivano-Frankivsk 37
* 10 Kyiv 1435
* 11 Kyiv city 1995
* 12 Kirovohrad 20
* 13 Luhansk 840
* 14 Lviv 429
* 15 Mykolayiv 415
* 16 Odessa 486
* 17 Poltava 86
* 18 Rivne 120
* 19 Sumy 465
* 20 Ternopil 27
* 21 Kharkiv 1258
* 22 Kherson 709
* 23 Khmelnytsky 82
* 24 Cherkasy 32
* 25 Chernivtsi 43
* 26 Chernihiv 680
* Crimea 335 [no respondents reached in Crimea]
* Sevastopol 41 [no respondents reached in Sevastapol]

* Enters VIINA events/observations for Wave 2 to dataset
gen w2_VIINA_events = .
replace w2_VIINA_events = 72 if w2_q4 == 2
replace w2_VIINA_events = 150 if w2_q4 == 3
replace w2_VIINA_events = 349 if w2_q4 == 4
replace w2_VIINA_events = 2274 if w2_q4 == 5
replace w2_VIINA_events = 180 if w2_q4 == 6
replace w2_VIINA_events = 117 if w2_q4 == 7
replace w2_VIINA_events = 763 if w2_q4 == 8
replace w2_VIINA_events = 37 if w2_q4 == 9
replace w2_VIINA_events = 1435 if w2_q4 == 10
replace w2_VIINA_events = 1995 if w2_q4 == 11
replace w2_VIINA_events = 20 if w2_q4 == 12
replace w2_VIINA_events = 840 if w2_q4 == 13
replace w2_VIINA_events = 429 if w2_q4 == 14
replace w2_VIINA_events = 415 if w2_q4 == 15
replace w2_VIINA_events = 486 if w2_q4 == 16
replace w2_VIINA_events = 86 if w2_q4 == 17
replace w2_VIINA_events = 120 if w2_q4 == 18
replace w2_VIINA_events = 465 if w2_q4 == 19
replace w2_VIINA_events = 27 if w2_q4 == 20
replace w2_VIINA_events = 1258 if w2_q4 == 21
replace w2_VIINA_events = 709 if w2_q4 == 22
replace w2_VIINA_events = 82 if w2_q4 == 23
replace w2_VIINA_events = 32 if w2_q4 == 24
replace w2_VIINA_events = 43 if w2_q4 == 25
replace w2_VIINA_events = 680 if w2_q4 == 26

** Normalizes VIINA variable for Wave 1
summ w2_VIINA_events
gen VIINA_W2_norm = (w2_VIINA_events - r(min)) / (r(max) - r(min)) 
summ VIINA_W2_norm

** Creates log-transformed version of the normalized VIINA variable for Wave 1
gen ln_VIINA_W2_norm = ln(VIINA_W2_norm)




*** Predictions of leader trait preferences from VIINA events (standard errors clustered at oblast-level)
** Wave 1 (Table SOM.12a)
reg Comp_scale_1 VIINA_W1_norm c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 i.sex c.age i.education, cluster(w1_q5)
reg Warm_scale_1 VIINA_W1_norm c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 i.sex c.age i.education, cluster(w1_q5)
reg Domi_scale_1 VIINA_W1_norm c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 i.sex c.age i.education, cluster(w1_q5)

* Analyses based on log-transformed VIINA-variable (not reported in manuscript or SOM.10)
reg Comp_scale_1 ln_VIINA_W1_norm c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 i.sex c.age i.education, cluster(w1_q5)
reg Warm_scale_1 ln_VIINA_W1_norm c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 i.sex c.age i.education, cluster(w1_q5)
reg Domi_scale_1 ln_VIINA_W1_norm c.fearfull_scale_1 c.aggressive_scale_1 c.sadness_scale_1 c.selfconf_scale_1 c.ID_Ukraine_1 c.ID_Europe_1 c.ID_Russia_1 i.sex c.age i.education, cluster(w1_q5)

** Based on wave 2 data (Table SOM.12b)
reg Comp_scale_2 VIINA_W2_norm c.fearfull_scale_2 c.aggressive_scale_2 c.sadness_scale_2 c.selfconf_scale_2 c.ID_Ukraine_2 c.ID_Europe_2 c.ID_Russia_2 i.sex c.age i.education, cluster(w2_q4)
reg Warm_scale_2 VIINA_W2_norm c.fearfull_scale_2 c.aggressive_scale_2 c.sadness_scale_2 c.selfconf_scale_2 c.ID_Ukraine_2 c.ID_Europe_2 c.ID_Russia_2 i.sex c.age i.education, cluster(w2_q4)
reg Domi_scale_2 VIINA_W2_norm c.fearfull_scale_2 c.aggressive_scale_2 c.sadness_scale_2 c.selfconf_scale_2 c.ID_Ukraine_2 c.ID_Europe_2 c.ID_Russia_2 i.sex c.age i.education, cluster(w2_q4)

* Analyses based on log-transformed VIINA-variable (not reported in manuscript or SOM.10)
reg Comp_scale_2 ln_VIINA_W2_norm c.fearfull_scale_2 c.aggressive_scale_2 c.sadness_scale_2 c.selfconf_scale_2 c.ID_Ukraine_2 c.ID_Europe_2 c.ID_Russia_2 i.sex c.age i.education, cluster(w2_q4)
reg Warm_scale_2 ln_VIINA_W2_norm c.fearfull_scale_2 c.aggressive_scale_2 c.sadness_scale_2 c.selfconf_scale_2 c.ID_Ukraine_2 c.ID_Europe_2 c.ID_Russia_2 i.sex c.age i.education, cluster(w2_q4)
reg Domi_scale_2 ln_VIINA_W2_norm c.fearfull_scale_2 c.aggressive_scale_2 c.sadness_scale_2 c.selfconf_scale_2 c.ID_Ukraine_2 c.ID_Europe_2 c.ID_Russia_2 i.sex c.age i.education, cluster(w2_q4)



**************************************************************************************************************************************************
********************************************************** RESHAPES DATASET TO LONG FORMAT *******************************************************
**************************************************************************************************************************************************
reshape long Competence_ Trustworthy_ Dominant_ Generous_ Strong_ Warm_ Toughminded_ Comp_scale_ Warm_scale_ Domi_scale_ Comp_PCA_ Warm_PCA_ Domi_PCA_ ///
afraid_ frightened_ scared_ angry_ hostile_ disgusted_ sad_ lonely_ downhearted_ proud_ strong_ confident_ anxiety_scale_ aggressive_scale_ sadness_scale_ selfconf_scale_ Victimization_ ///
Conflict_ ID_Ukraine_ ID_Russia_ ID_Europe_, i(ID_random) j(wave)

** Labels survey round variable
label define waveLB 1 "Round 1 (context primed)" 2 "Round 2 (no context primed)"
label values wave waveLB

*** Sets panelvar to ID_random
xtset ID_random


********************************************** MAPPING WARTIME LEADER TRAIT PREFERENCES **********************************************************
*** Creates Figure 1
reg Comp_scale_ i.wave if Context== 1 & include==1, cluster(ID_random)
test _cons == .7034314
test _cons == .5274064
margins, at(wave=(1 2)) level(95)
marginsplot,  recastci(rcap) yscale(range(0(.1)1)) ylabel(0(.1)1) recast(scatter) yline(0) ///
xtitle("Competence") ytitle("Competence Importance") title("Competence") legend(off) scheme(s1mono) name(Comp_war_mean_2waves, replace)

reg Warm_scale_ i.wave if Context== 1 & include==1, cluster(ID_random)
test _cons == .8989899
test _cons == .5274064
margins, at(wave=(1 2)) level(95)
marginsplot,  recastci(rcap) yscale(range(0(.1)1)) ylabel(0(.1)1) recast(scatter) yline(0) ///
xtitle("Warmth") ytitle("Warmth Importance") title("Warmth") legend(off)  scheme(s1mono) name(Warmth_war_mean_2waves, replace)

reg Domi_scale_ i.wave if Context== 1 & include==1, cluster(ID_random)
test _cons == .8989899
test _cons == .7034314
margins, at(wave=(1 2)) level(95)
marginsplot,  recastci(rcap) yscale(range(0(.1)1)) ylabel(0(.1)1) recast(scatter) yline(0) ///
xtitle("Dominance") ytitle("Dominance Importance") title("Dominance") legend(off)  scheme(s1mono) name(Domi_war_mean_2waves, replace)

graph combine Comp_war_mean_2waves Warmth_war_mean_2waves Domi_war_mean_2waves, scheme(s1mono) cols(3)


************************************************** TESTING THE CONFLICT-SENSITIVITY HYPOTHESIS ***************************************************
*** Within-respondent test of the conflict-sensitivity hypothesis (testing if trait preferences change across waves for respondents assigned to the peace condition in wave 1)
* Key results reported in main text and full models in SOM.4b
reg Comp_scale_ i.wave if include==1 & Context == 2, cluster(ID_random)
reg Warm_scale_ i.wave if include==1 & Context == 2, cluster(ID_random)
reg Domi_scale_ i.wave if include==1 & Context == 2, cluster(ID_random)

* Testing full interactions between assigned experimental condition (assigned in wave 1) and wave (all respondents assigned to think of the ongoing war in wave 2)
reg Comp_scale_ i.wave##ib(2).Context if include==1, cluster(ID_random)
reg Warm_scale_ i.wave##ib(2).Context if include==1, cluster(ID_random)
reg Domi_scale_ i.wave##ib(2).Context if include==1, cluster(ID_random)


*** SOM.7: Within-respondent test of the Conflict-Sensitivity Hypothesis using factor score variables for trait measurement (reported in table SOM.7.a.2)
* Testing within-respondent change among respondent assigned to peace condition in wave 1
reg Comp_PCA_ i.wave if include_PCA==1 & Context == 2, cluster(ID_random)
reg Warm_PCA_ i.wave if include_PCA==1 & Context == 2, cluster(ID_random)
reg Domi_PCA_ i.wave if include_PCA==1 & Context == 2, cluster(ID_random)

* Full interactions between assigned experimental condition (assigned in wave 1) and wave (all respondents assigned to think of the ongoing war in wave 2)
reg Comp_PCA_ i.wave##ib(2).Context if include==1, cluster(ID_random)
reg Warm_PCA_ i.wave##ib(2).Context if include==1, cluster(ID_random)
reg Domi_PCA_ i.wave##ib(2).Context if include==1, cluster(ID_random)


*******************************************************************************************************************************************************

log close
translate trait_preferences_Ukraine.smcl trait_preferences_Ukraine.pdf
